import type {
  AjaxPagingResult,
  KeyEquipmentInfo,
  KeyEquipmentQueryListParams,
  KeyEquipmentSaveOrUpdateParams,
} from '@/types'

const controller = getAjaxBaseUrl(
  '/keyEquipment',
  '/energy',
)

/** 新增或修改设备台账信息 */
export function saveOrUpdate(params: Partial<KeyEquipmentSaveOrUpdateParams>) {
  return post(`${controller}/saveOrUpdateKeyDevice`, params)
}

/** 分页查询设备台账信息 */
export function queryList(params: Partial<KeyEquipmentQueryListParams>) {
  return post<AjaxPagingResult<KeyEquipmentInfo[]> | null>(
    `${controller}/selectKeyDevicePage`,
    params,
  )
}

/** 删除设备台账信息 */
export function deleteById(id: number) {
  return get(`${controller}/deleteKeyDevice`, { id })
}
